<?php

include_once("../mailer/class.phpmailer.php");
include_once("../mailer/class.smtp.php");

/**
 * Description of Gmail
 *
 * @author User
 */
class Gmail {

    function __construct() {
        
    }

    function send($address, $asunto, $msg, $adjunto) {

        $result = false;
        try {
            $mail = new PHPMailer();
            $mail->IsSMTP();
            $mail->SMTPAuth = true;
            $mail->SMTPSecure = "ssl";
            $mail->Host = "smtp.gmail.com";
            $mail->Port = 465;

            $mail->Username = "sgtunel@gmail.com";
            $mail->Password = "Sa17118159";

            $mail->From = "sgtunel@gmail.com";
            $mail->FromName = "Sistema de Gestión de Obras Tipo Tunel, Municipio Bolivariano Plaza.";
            $mail->Subject = $asunto;
            $mail->AltBody = "";
            $mail->MsgHTML($msg);
            $mail->IsHTML(true);

            if ($adjunto != "") {
                $mail->AddAttachment($adjunto);
            }

            $i = 0;
            for ($i = 0; $i < count($address); $i++) {
                $mail->AddAddress($address[$i], $address[$i]);
            }           

            $result = $mail->Send();
        } catch (Exception $e) {
            
        }
        return $result;
    }

}

?>
